package org.idea.spring.ioc.dao;

import org.idea.spring.ioc.bean.User;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author idea
 * @Date created in 4:01 下午 2020/4/19
 */
public class UserFactory {

    static Map<String, User> userMap = new HashMap<>(3);
    static {
      userMap.put("1",new User(1,"user_01"));
      userMap.put("2",new User(2,"user_02"));
      userMap.put("3",new User(3,"user_03"));
    }

    public static User getUserFromMap(String id){
        return userMap.get(id);
    }

    public  User getDynamicUser(int id){
        System.out.println("需要先创建对象本身，然后再来调用对象信息");
        return new User(id,"user_0"+id);
    }

}
